﻿Namespace DoFactory.GangOfFour.Strategy.RealWorld3

    Public Class Program
        Public Shared Sub Main()
            Dim game As New ChessGame()

            game.ComputerPlayer = New EasyComputerPlayer()
            game.Move()
            'move using Easy difficulty
            game.ComputerPlayer = New MediumComputerPlayer()
            game.Move()
            'move using Medium difficulty
            game.ComputerPlayer = New AdvancedComputerPlayer()
            game.Move()
            'move using Advanced difficulty
        End Sub
    End Class

    Public Interface IComputerPlayer
        Sub MakeMove()
    End Interface

    Public Class EasyComputerPlayer
        Implements IComputerPlayer
        Private Sub IComputerPlayer_MakeMove() Implements IComputerPlayer.MakeMove
            Console.WriteLine("Computer made an Easy move.")
        End Sub
    End Class

    Public Class MediumComputerPlayer
        Implements IComputerPlayer
        Private Sub IComputerPlayer_MakeMove() Implements IComputerPlayer.MakeMove
            Console.WriteLine("Computer made an Medium move.")
        End Sub
    End Class

    Public Class AdvancedComputerPlayer
        Implements IComputerPlayer
        Private Sub IComputerPlayer_MakeMove() Implements IComputerPlayer.MakeMove
            Console.WriteLine("Computer made an Advanced move.")
        End Sub

    End Class

    Public Class ChessGame
        Private m_computerPlayer As IComputerPlayer

        Public Property ComputerPlayer() As IComputerPlayer
            Get
                Return m_computerPlayer
            End Get
            Set(ByVal value As IComputerPlayer)
                m_computerPlayer = value
            End Set
        End Property

        Public Sub Move()
            m_computerPlayer.MakeMove()
            'exhibit the behavior
        End Sub
    End Class

End Namespace
